/ Assembly List / LJCNetCommon / NetCommon / BytesToMemStream

Namespace - LJCNetCommon


Parameters
bytes - The byte array.

Returns

The reference to the memory stream.

Syntax

C#
public static Stream BytesToMemStream(Byte[] bytes)

Copies a byte array to a memory stream. (E)

Example

C#
using System.IO;
using LJCNetCommon;
        
// Copies a byte array to a memory stream.
private static void BytesToMemStream()
{
  // Setup
  byte[] bytes = NetCommon.TextToBytes("Text");

  // Copies a byte array to a memory stream.
  using (Stream stream = NetCommon.BytesToMemStream(bytes))
  {
    // Check the text.
    string text = NetCommon.MemStreamToString(stream);
  }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.